<script setup >
import { ref, reactive } from "vue";
import { NBreadcrumb, NBreadcrumbItem, NButton } from "naive-ui";
import { useRoute } from "vue-router";
import { findOrderDetail } from "@/api/order";

const route = useRoute();

let order = ref(null);
findOrderDetail(route.query.orderId).then((res) => {
  order.value = res;
});
</script>

<template>
  <div class="pay-page bg">
    <div class="container">
      <n-breadcrumb style="padding: 20px 0px">
        <n-breadcrumbItem href="/">首页</n-breadcrumbItem>
        <n-breadcrumbItem href="/cart">购物车</n-breadcrumbItem>
        <n-breadcrumbItem>支付结果</n-breadcrumbItem>
      </n-breadcrumb>
      <!-- 支付结果 -->
      <div class="pay-result">
        <span
          v-if="route.query.payResult"
          class="iconfont icon-check-circle-fill green"
        ></span>
        <span v-else class="iconfont icon-close-circle-fill red"></span>
        <p class="tit">订单支付{{ route.query.payResult ? "成功" : "失败" }}</p>
        <p class="tip">我们将尽快为您发货，收货期间请保持手机畅通</p>
        <p>支付方式：<span>支付宝支付</span></p>
        <p v-if="order">
          支付金额：<span class="red">¥{{ order.payMoney.toFixed(2) }}</span>
        </p>
        <div class="btn">
          <n-button
            type="primary"
            style="margin-right: 20px"
            @click="$router.push('/member/order')"
            >查看订单</n-button
          >
          <n-button type="default" @click="$router.push('/')"
            >进入首页</n-button
          >
        </div>
        <p class="alert">
          <span class="iconfont icon-tip"></span>
          温馨提示：平台不会以订单异常、系统升级为由要求您点击任何网址链接进行退款操作，保护资产、谨慎操作。
        </p>
      </div>
    </div>
  </div>
</template>

<style scoped lang='less'>
.pay-result {
  padding: 100px 0;
  background: #fff;
  text-align: center;
  > .iconfont {
    font-size: 100px;
  }
  .green {
    color: #1dc779;
  }
  .red {
    color: @priceColor;
  }
  .tit {
    font-size: 24px;
  }
  .tip {
    color: #999;
  }
  p {
    line-height: 40px;
    font-size: 15px;
  }
  .btn {
    margin-top: 50px;
  }
  .alert {
    font-size: 12px;
    color: #999;
    margin-top: 50px;
  }
}
</style>